<template>
    <view class="order-item" v-if="data">
        <view class="order-item-top">
            <text class="order-desc-text">订单编号：{{ data.Sn }}</text>
            <text class="order-desc-text">下单时间：{{ data.AddTime }}</text>
        </view>
        <view class="order-item-main" @click="goOrderDetail">
            <view class="order-item-imgs" v-if="data.DetailList">
                <view class="img-item" v-for="(item, index) in data.DetailList.slice(0, 1)" :key="index">
                    <view class="order-name">{{ item.Name }}</view>
                    <!-- <image :src="easyGetImgUrl(item.ProductImage)" class="order-item-img"></image>
					<text class="text-num">x{{item.Amount}}{{item.UnitName?item.UnitName:item.RatioUnit}}</text> -->
                </view>
            </view>
            <view class="flex">
                <view><text>详情</text><uni-icons type="arrowright"></uni-icons></view>
                <text class="order-kind" v-if="false">({{ data.DetailList.length }}种{{ getTotalNum() }}件)</text>
            </view>
        </view>
        <view class="order-item-price">
            <view class="order-desc">
                <!-- <text>种类:{{data.DetailList.length}}</text>
				<text>数量:{{getTotalNum()}}</text> -->
            </view>
            <view class="order-price">
                <text>总计:</text>
                <text class="price-text">¥{{ data.PayMoney }}</text>
            </view>
        </view>
    </view>
</template>

<script>
export default {
    props: {
        data: {
            type: Object,
            default: {},
        },
    },
    data() {
        return {}
    },
    methods: {
        goOrderDetail() {
            this.easyGoTo("/pages_shop/packet/return/billSelect?id=" + this.data.OrderId)
        },
        getTotalNum() {
            let num = 0
            this.data.DetailList.forEach((e) => {
                num += e.Amount
            })
            return num
        },
    },
}
</script>

<style lang="scss">
@import "style/orderItem.scss";
.flex {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
</style>
